import config from './env.production';
import configDevelopment from './env.development';
import configStage from './env.stage';
import configPre from './env.pre';

let currentEnv = 'prod';


const exportConfig: typeof config = config;
console.log('VITE_APP_ENV',import.meta.env.VITE_APP_ENV);

if(import.meta.env.VITE_APP_ENV !== 'prod'){
    currentEnv = (localStorage.getItem('currentEnv')|| import.meta.env.VITE_APP_ENV) as string

    let sourceConfig:any = {};
  if (currentEnv === 'dev') {
    sourceConfig = configDevelopment;
  } else if (currentEnv === 'stage') {
    sourceConfig = configStage;
  } else if (currentEnv === 'pre') {
    sourceConfig = configPre;
  }
  for (const i in sourceConfig) {
    exportConfig[i] = sourceConfig[i];
  }
  console.log('exportConfig',exportConfig)
}

export default exportConfig;